Xbasic

LEFT Function

Syntax

Output_String as C = LEFT(C text,N Number_of_characters)

Arguments

text

A character string.

Number_of_characters

The number of characters to return. If Number_Of_Characters is positive, the function returns Number_Of_Characters of characters from the beginning of Input_String. If Number_Of_Characters is negative, the function returns LEN( Input_String ) - Number_Of_Characters from the beginning of Input_String. Numeric

Description

Returns a portion of a string, starting with the leftmost character.

Discussion

LEFT() returns a character string containing the left-most Number_Of_Characters of the Input_String. LEFT( Input_String, Number_Of_Characters) achieves the same result as SUBSTR(Input_String, 1, Number_Of_Characters).

Example

dim firstname as C
firstname = "Beverley"
? left(firstname, 2)
= "Be"
? left(firstname, -2)
= "Beverl"

See Also